package com.bite.demo.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

// 默认是按照名称 但是不太好 所以用 @Order 来 @Order 越大越后面

@Order(1)
@Slf4j
//@Component
@Aspect // 表示是切面类
public class MyAspectDemo {

    @Pointcut("execution(* com.bite.demo.controller.*.*(..))")
    public void pc() {};

    @Before("pc()")
    public void before(JoinPoint joinPoint) {
        log.info(joinPoint.getSignature().toShortString() + " 执行 before ");
    }
    @Before("pc()")
    public void after(JoinPoint joinPoint) {
        log.info(joinPoint.getSignature().toShortString() + " 执行 after ");
    }

}
